
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>基于 timeout 机制为服务接口调用超时提供安全保护 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="hystrix-thread-pool-current-limiting.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">高并发架构</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../high-concurrent/mq-interview.html">
            
                <a href="../high-concurrent/mq-interview.html">
            
                    
                    消息队列
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="../high-concurrent/why-mq.html">
            
                <a href="../high-concurrent/why-mq.html">
            
                    
                    为什么使用消息队列？消息队列有什么优点和缺点？Kafka、ActiveMQ、RabbitMQ、RocketMQ 都有什么优点和缺点？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="../high-concurrent/how-to-ensure-high-availability-of-message-queues.html">
            
                <a href="../high-concurrent/how-to-ensure-high-availability-of-message-queues.html">
            
                    
                    如何保证消息队列的高可用？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="../high-concurrent/how-to-ensure-that-messages-are-not-repeatedly-consumed.html">
            
                <a href="../high-concurrent/how-to-ensure-that-messages-are-not-repeatedly-consumed.html">
            
                    
                    如何保证消息不被重复消费？（如何保证消息消费的幂等性）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="../high-concurrent/how-to-ensure-the-reliable-transmission-of-messages.html">
            
                <a href="../high-concurrent/how-to-ensure-the-reliable-transmission-of-messages.html">
            
                    
                    如何保证消息的可靠性传输？（如何处理消息丢失的问题）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5" data-path="../high-concurrent/how-to-ensure-the-order-of-messages.html">
            
                <a href="../high-concurrent/how-to-ensure-the-order-of-messages.html">
            
                    
                    如何保证消息的顺序性？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.6" data-path="../high-concurrent/mq-time-delay-and-expired-failure.html">
            
                <a href="../high-concurrent/mq-time-delay-and-expired-failure.html">
            
                    
                    如何解决消息队列的延时以及过期失效问题？消息队列满了以后该怎么处理？有几百万消息持续积压几小时，说说怎么解决？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7" data-path="../high-concurrent/mq-design.html">
            
                <a href="../high-concurrent/mq-design.html">
            
                    
                    如果让你写一个消息队列，该如何进行架构设计啊？说一下你的思路。
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="../high-concurrent/es-introduction.html">
            
                <a href="../high-concurrent/es-introduction.html">
            
                    
                    搜索引擎
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="../high-concurrent/es-architecture.html">
            
                <a href="../high-concurrent/es-architecture.html">
            
                    
                    es 的分布式架构原理能说一下么（es 是如何实现分布式的啊）？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.2" data-path="../high-concurrent/es-write-query-search.html">
            
                <a href="../high-concurrent/es-write-query-search.html">
            
                    
                    es 写入数据的工作原理是什么啊？es 查询数据的工作原理是什么啊？底层的 lucene 介绍一下呗？倒排索引了解吗？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.3" data-path="../high-concurrent/es-optimizing-query-performance.html">
            
                <a href="../high-concurrent/es-optimizing-query-performance.html">
            
                    
                    es 在数据量很大的情况下（数十亿级别）如何提高查询效率啊？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.4" data-path="../high-concurrent/es-production-cluster.html">
            
                <a href="../high-concurrent/es-production-cluster.html">
            
                    
                    es 生产集群的部署架构是什么？每个索引的数据量大概有多少？每个索引大概有多少个分片？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" >
            
                <span>
            
                    
                    缓存
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="../high-concurrent/why-cache.html">
            
                <a href="../high-concurrent/why-cache.html">
            
                    
                    在项目中缓存是如何使用的？缓存如果使用不当会造成什么后果？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.2" data-path="../high-concurrent/redis-single-thread-model.html">
            
                <a href="../high-concurrent/redis-single-thread-model.html">
            
                    
                    Redis 和 Memcached 有什么区别？Redis 的线程模型是什么？为什么单线程的 Redis 比多线程的 Memcached 效率要高得多？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.3" data-path="../high-concurrent/redis-data-types.html">
            
                <a href="../high-concurrent/redis-data-types.html">
            
                    
                    Redis 都有哪些数据类型？分别在哪些场景下使用比较合适？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.4" data-path="../high-concurrent/redis-expiration-policies-and-lru.html">
            
                <a href="../high-concurrent/redis-expiration-policies-and-lru.html">
            
                    
                    Redis 的过期策略都有哪些？手写一下 LRU 代码实现？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.5" data-path="../high-concurrent/how-to-ensure-high-concurrent-and-high-availability-of-redis.html">
            
                <a href="../high-concurrent/how-to-ensure-high-concurrent-and-high-availability-of-redis.html">
            
                    
                    如何保证 Redis 高并发、高可用？Redis 的主从复制原理能介绍一下么？Redis 的哨兵原理能介绍一下么？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.6" data-path="../high-concurrent/redis-persistence.html">
            
                <a href="../high-concurrent/redis-persistence.html">
            
                    
                    Redis 的持久化有哪几种方式？不同的持久化机制都有什么优缺点？持久化机制具体底层是如何实现的？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.7" data-path="../high-concurrent/redis-cluster.html">
            
                <a href="../high-concurrent/redis-cluster.html">
            
                    
                    Redis 集群模式的工作原理能说一下么？在集群模式下，Redis 的 key 是如何寻址的？分布式寻址都有哪些算法？了解一致性 hash 算法吗？如何动态增加和删除一个节点？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.8" data-path="../high-concurrent/redis-caching-avalanche-and-caching-penetration.html">
            
                <a href="../high-concurrent/redis-caching-avalanche-and-caching-penetration.html">
            
                    
                    了解什么是 redis 的雪崩、穿透和击穿？Redis 崩溃之后会怎么样？系统该如何应对这种情况？如何处理 Redis 的穿透？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.9" data-path="../high-concurrent/redis-consistence.html">
            
                <a href="../high-concurrent/redis-consistence.html">
            
                    
                    如何保证缓存与数据库的双写一致性？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.10" data-path="../high-concurrent/redis-cas.html">
            
                <a href="../high-concurrent/redis-cas.html">
            
                    
                    Redis 的并发竞争问题是什么？如何解决这个问题？了解 Redis 事务的 CAS 方案吗？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.11" data-path="../high-concurrent/redis-production-environment.html">
            
                <a href="../high-concurrent/redis-production-environment.html">
            
                    
                    生产环境中的 Redis 是怎么部署的？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" >
            
                <span>
            
                    
                    分库分表
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="../high-concurrent/database-shard.html">
            
                <a href="../high-concurrent/database-shard.html">
            
                    
                    为什么要分库分表（设计高并发系统的时候，数据库层面该如何设计）？用过哪些分库分表中间件？不同的分库分表中间件都有什么优点和缺点？你们具体是如何对数据库如何进行垂直拆分或水平拆分的？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.2" data-path="../high-concurrent/database-shard-method.html">
            
                <a href="../high-concurrent/database-shard-method.html">
            
                    
                    现在有一个未分库分表的系统，未来要分库分表，如何设计才可以让系统从未分库分表动态切换到分库分表上？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.3" data-path="../high-concurrent/database-shard-dynamic-expand.html">
            
                <a href="../high-concurrent/database-shard-dynamic-expand.html">
            
                    
                    如何设计可以动态扩容缩容的分库分表方案？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.4" data-path="../high-concurrent/database-shard-global-id-generate.html">
            
                <a href="../high-concurrent/database-shard-global-id-generate.html">
            
                    
                    分库分表之后，id 主键如何处理？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" >
            
                <span>
            
                    
                    读写分离
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.5.1" data-path="../high-concurrent/mysql-read-write-separation.html">
            
                <a href="../high-concurrent/mysql-read-write-separation.html">
            
                    
                    如何实现 MySQL 的读写分离？MySQL 主从复制原理是啥？如何解决 MySQL 主从同步的延时问题？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.6" >
            
                <span>
            
                    
                    高并发系统
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.6.1" data-path="../high-concurrent/high-concurrent-design.html">
            
                <a href="../high-concurrent/high-concurrent-design.html">
            
                    
                    如何设计一个高并发系统？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">分布式系统</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../distributed-system/distributed-system-interview.html">
            
                <a href="../distributed-system/distributed-system-interview.html">
            
                    
                    面试连环炮
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" >
            
                <span>
            
                    
                    系统拆分
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.2.1" data-path="../distributed-system/why-dubbo.html">
            
                <a href="../distributed-system/why-dubbo.html">
            
                    
                    为什么要进行系统拆分？如何进行系统拆分？拆分后不用 Dubbo 可以吗？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.3" >
            
                <span>
            
                    
                    分布式服务框架
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.3.1" data-path="../distributed-system/dubbo-operating-principle.html">
            
                <a href="../distributed-system/dubbo-operating-principle.html">
            
                    
                    说一下 Dubbo 的工作原理？注册中心挂了可以继续通信吗？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.2" data-path="../distributed-system/dubbo-serialization-protocol.html">
            
                <a href="../distributed-system/dubbo-serialization-protocol.html">
            
                    
                    Dubbo 支持哪些序列化协议？说一下 Hessian 的数据结构？PB 知道吗？为什么 PB 的效率是最高的？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.3" data-path="../distributed-system/dubbo-load-balancing.html">
            
                <a href="../distributed-system/dubbo-load-balancing.html">
            
                    
                    Dubbo 负载均衡策略和集群容错策略都有哪些？动态代理策略呢？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.4" data-path="../distributed-system/dubbo-spi.html">
            
                <a href="../distributed-system/dubbo-spi.html">
            
                    
                    Dubbo 的 spi 思想是什么？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.5" data-path="../distributed-system/dubbo-service-management.html">
            
                <a href="../distributed-system/dubbo-service-management.html">
            
                    
                    如何基于 Dubbo 进行服务治理、服务降级、失败重试以及超时重试？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.6" data-path="../distributed-system/distributed-system-idempotency.html">
            
                <a href="../distributed-system/distributed-system-idempotency.html">
            
                    
                    分布式服务接口的幂等性如何设计（比如不能重复扣款）？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.7" data-path="../distributed-system/distributed-system-request-sequence.html">
            
                <a href="../distributed-system/distributed-system-request-sequence.html">
            
                    
                    分布式服务接口请求的顺序性如何保证？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.8" data-path="../distributed-system/dubbo-rpc-design.html">
            
                <a href="../distributed-system/dubbo-rpc-design.html">
            
                    
                    如何自己设计一个类似 Dubbo 的 RPC 框架？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.4" >
            
                <span>
            
                    
                    分布式锁
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.4.1" data-path="../distributed-system/zookeeper-application-scenarios.html">
            
                <a href="../distributed-system/zookeeper-application-scenarios.html">
            
                    
                    Zookeeper 都有哪些应用场景？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.2" data-path="../distributed-system/distributed-lock-redis-vs-zookeeper.html">
            
                <a href="../distributed-system/distributed-lock-redis-vs-zookeeper.html">
            
                    
                    使用 Redis 如何设计分布式锁？使用 Zookeeper 来设计分布式锁可以吗？以上两种分布式锁的实现方式哪种效率比较高？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.5" >
            
                <span>
            
                    
                    分布式事务
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.5.1" data-path="../distributed-system/distributed-transaction.html">
            
                <a href="../distributed-system/distributed-transaction.html">
            
                    
                    分布式事务了解吗？你们如何解决分布式事务问题的？TCC 如果出现网络连不通怎么办？XA 的一致性如何保证？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.6" >
            
                <span>
            
                    
                    分布式会话
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.6.1" data-path="../distributed-system/distributed-session.html">
            
                <a href="../distributed-system/distributed-session.html">
            
                    
                    集群部署时的分布式 Session 如何实现？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="hystrix-introduction.html">
            
                <a href="hystrix-introduction.html">
            
                    
                    Hystrix 介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="e-commerce-website-detail-page-architecture.html">
            
                <a href="e-commerce-website-detail-page-architecture.html">
            
                    
                    电商网站详情页系统架构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="hystrix-thread-pool-isolation.html">
            
                <a href="hystrix-thread-pool-isolation.html">
            
                    
                    Hystrix 线程池技术实现资源隔离
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.10" data-path="hystrix-semphore-isolation.html">
            
                <a href="hystrix-semphore-isolation.html">
            
                    
                    Hystrix 信号量机制实现资源隔离
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11" data-path="hystrix-execution-isolation.html">
            
                <a href="hystrix-execution-isolation.html">
            
                    
                    Hystrix 隔离策略细粒度控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.12" data-path="hystrix-process.html">
            
                <a href="hystrix-process.html">
            
                    
                    深入 Hystrix 执行时内部原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.13" data-path="hystrix-request-cache.html">
            
                <a href="hystrix-request-cache.html">
            
                    
                    基于 request cache 请求缓存技术优化批量商品数据查询接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.14" data-path="hystrix-fallback.html">
            
                <a href="hystrix-fallback.html">
            
                    
                    基于本地缓存的 fallback 降级机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.15" data-path="hystrix-circuit-breaker.html">
            
                <a href="hystrix-circuit-breaker.html">
            
                    
                    深入 Hystrix 断路器执行原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.16" data-path="hystrix-thread-pool-current-limiting.html">
            
                <a href="hystrix-thread-pool-current-limiting.html">
            
                    
                    深入 Hystrix 线程池隔离与接口限流
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="3.17" data-path="hystrix-timeout.html">
            
                <a href="hystrix-timeout.html">
            
                    
                    基于 timeout 机制为服务接口调用超时提供安全保护
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.18" >
            
                <span>
            
                    
                    高可用系统
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.18.1" >
            
                <span>
            
                    
                    如何设计一个高可用系统？
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.19" >
            
                <span>
            
                    
                    限流
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.19.1" data-path="../high-concurrent/huifer-how-to-limit-current.html">
            
                <a href="../high-concurrent/huifer-how-to-limit-current.html">
            
                    
                    如何限流？在工作中是怎么做的？说一下具体的实现？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.20" >
            
                <span>
            
                    
                    熔断
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.20.1" >
            
                <span>
            
                    
                    如何进行熔断？
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="3.20.2" >
            
                <span>
            
                    
                    熔断框架都有哪些？具体实现原理知道吗？
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="3.20.3" data-path="sentinel-vs-hystrix.html">
            
                <a href="sentinel-vs-hystrix.html">
            
                    
                    熔断框架如何做技术选型？选用 Sentinel 还是 Hystrix？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.21" >
            
                <span>
            
                    
                    降级
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.21.1" >
            
                <span>
            
                    
                    如何进行降级？
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">微服务架构</li>
        
        
    
        <li class="chapter " data-level="4.1" >
            
                <a target="_blank" href="https://github.com/doocs/advanced-java">
            
                    
                    微服务架构整个章节内容属额外新增，后续抽空更新，也欢迎读者们参与补充完善
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="../micro-services/microservices-introduction.html">
            
                <a href="../micro-services/microservices-introduction.html">
            
                    
                    关于微服务架构的描述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="../micro-services/migrating-from-a-monolithic-architecture-to-a-microservices-architecture.html">
            
                <a href="../micro-services/migrating-from-a-monolithic-architecture-to-a-microservices-architecture.html">
            
                    
                    从单体式架构迁移到微服务架构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="../micro-services/event-driven-data-management-for-microservices.html">
            
                <a href="../micro-services/event-driven-data-management-for-microservices.html">
            
                    
                    微服务的事件驱动数据管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="../micro-services/choose-microservice-deployment-strategy.html">
            
                <a href="../micro-services/choose-microservice-deployment-strategy.html">
            
                    
                    选择微服务部署策略
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Spring Cloud 微服务架构</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../micro-services/huifer-what's-microservice-how-to-communicate.html">
            
                <a href="../micro-services/huifer-what's-microservice-how-to-communicate.html">
            
                    
                    什么是微服务？微服务之间是如何独立通讯的？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" >
            
                <span>
            
                    
                    Spring Cloud 和 Dubbo 有哪些区别？
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="5.3" >
            
                <span>
            
                    
                    Spring Boot 和 Spring Cloud，谈谈你对它们的理解？
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="5.4" >
            
                <span>
            
                    
                    什么是服务熔断？什么是服务降级？
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="5.5" >
            
                <span>
            
                    
                    微服务的优缺点分别是什么？说一下你在项目开发中碰到的坑？
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="../micro-services/huifer-micro-services-technology-stack.html">
            
                <a href="../micro-services/huifer-micro-services-technology-stack.html">
            
                    
                    你所知道的微服务技术栈都有哪些？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.7" data-path="../micro-services/huifer-micro-service-governance.html">
            
                <a href="../micro-services/huifer-micro-service-governance.html">
            
                    
                    微服务治理策略
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.8" >
            
                <span>
            
                    
                    Eureka 和 Zookeeper 都可以提供服务注册与发现的功能，它们有什么区别？
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="5.9" >
            
                <span>
            
                    
                    ......
            
                </span>
            

            
        </li>
    

    
        
        <li class="header">海量数据处理</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="../big-data/find-common-urls.html">
            
                <a href="../big-data/find-common-urls.html">
            
                    
                    如何从大量的 URL 中找出相同的 URL？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="../big-data/find-top-100-words.html">
            
                <a href="../big-data/find-top-100-words.html">
            
                    
                    如何从大量数据中找出高频词？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="../big-data/find-top-1-ip.html">
            
                <a href="../big-data/find-top-1-ip.html">
            
                    
                    如何找出某一天访问百度网站最多的 IP？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="../big-data/find-no-repeat-number.html">
            
                <a href="../big-data/find-no-repeat-number.html">
            
                    
                    如何在大量的数据中找出不重复的整数？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.5" data-path="../big-data/find-a-number-if-exists.html">
            
                <a href="../big-data/find-a-number-if-exists.html">
            
                    
                    如何在大量的数据中判断一个数是否存在？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.6" data-path="../big-data/find-hotest-query-string.html">
            
                <a href="../big-data/find-hotest-query-string.html">
            
                    
                    如何查询最热门的查询串？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.7" data-path="../big-data/count-different-phone-numbers.html">
            
                <a href="../big-data/count-different-phone-numbers.html">
            
                    
                    如何统计不同电话号码的个数？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.8" data-path="../big-data/find-mid-value-in-500-millions.html">
            
                <a href="../big-data/find-mid-value-in-500-millions.html">
            
                    
                    如何从 5 亿个数中找出中位数？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.9" data-path="../big-data/sort-the-query-strings-by-counts.html">
            
                <a href="../big-data/sort-the-query-strings-by-counts.html">
            
                    
                    如何按照 query 的频度排序？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.10" data-path="../big-data/find-rank-top-500-numbers.html">
            
                <a href="../big-data/find-rank-top-500-numbers.html">
            
                    
                    如何找出排名前 500 的数？
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >基于 timeout 机制为服务接口调用超时提供安全保护</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="&#x57FA;&#x4E8E;-timeout-&#x673A;&#x5236;&#x4E3A;&#x670D;&#x52A1;&#x63A5;&#x53E3;&#x8C03;&#x7528;&#x8D85;&#x65F6;&#x63D0;&#x4F9B;&#x5B89;&#x5168;&#x4FDD;&#x62A4;">&#x57FA;&#x4E8E; timeout &#x673A;&#x5236;&#x4E3A;&#x670D;&#x52A1;&#x63A5;&#x53E3;&#x8C03;&#x7528;&#x8D85;&#x65F6;&#x63D0;&#x4F9B;&#x5B89;&#x5168;&#x4FDD;&#x62A4;</h2>
<p>&#x4E00;&#x822C;&#x6765;&#x8BF4;&#xFF0C;&#x5728;&#x8C03;&#x7528;&#x4F9D;&#x8D56;&#x670D;&#x52A1;&#x7684;&#x63A5;&#x53E3;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x6BD4;&#x8F83;&#x5E38;&#x89C1;&#x7684;&#x4E00;&#x4E2A;&#x95EE;&#x9898;&#x5C31;&#x662F;<strong>&#x8D85;&#x65F6;</strong>&#x3002;&#x8D85;&#x65F6;&#x662F;&#x5728;&#x4E00;&#x4E2A;&#x590D;&#x6742;&#x7684;&#x5206;&#x5E03;&#x5F0F;&#x7CFB;&#x7EDF;&#x4E2D;&#xFF0C;&#x5BFC;&#x81F4;&#x7CFB;&#x7EDF;&#x4E0D;&#x7A33;&#x5B9A;&#xFF0C;&#x6216;&#x8005;&#x7CFB;&#x7EDF;&#x6296;&#x52A8;&#x3002;&#x51FA;&#x73B0;&#x5927;&#x91CF;&#x8D85;&#x65F6;&#xFF0C;&#x7EBF;&#x7A0B;&#x8D44;&#x6E90;&#x4F1A;&#x88AB; hang &#x6B7B;&#xFF0C;&#x4ECE;&#x800C;&#x5BFC;&#x81F4;&#x541E;&#x5410;&#x91CF;&#x5927;&#x5E45;&#x5EA6;&#x4E0B;&#x964D;&#xFF0C;&#x751A;&#x81F3;&#x670D;&#x52A1;&#x5D29;&#x6E83;&#x3002;</p>
<p>&#x4F60;&#x53BB;&#x8C03;&#x7528;&#x5404;&#x79CD;&#x5404;&#x6837;&#x7684;&#x4F9D;&#x8D56;&#x670D;&#x52A1;&#xFF0C;&#x7279;&#x522B;&#x662F;&#x5728;&#x5927;&#x516C;&#x53F8;&#xFF0C;&#x4F60;&#x751A;&#x81F3;&#x90FD;&#x4E0D;&#x8BA4;&#x8BC6;&#x5F00;&#x53D1;&#x4E00;&#x4E2A;&#x670D;&#x52A1;&#x7684;&#x4EBA;&#xFF0C;&#x4F60;&#x90FD;&#x4E0D;&#x77E5;&#x9053;&#x90A3;&#x4E2A;&#x4EBA;&#x7684;&#x6280;&#x672F;&#x6C34;&#x5E73;&#x600E;&#x4E48;&#x6837;&#xFF0C;&#x5BF9;&#x90A3;&#x4E2A;&#x4EBA;&#x6839;&#x672C;&#x4E0D;&#x4E86;&#x89E3;&#x3002;</p>
<p>Peter Steiner &#x8BF4;&#x8FC7;&#xFF0C;&quot;<a href="https://en.wikipedia.org/wiki/On_the_Internet,_nobody_knows_you%27re_a_dog" target="_blank">On the Internet, nobody knows you&apos;re a dog</a>&quot;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;&#x5728;&#x4E92;&#x8054;&#x7F51;&#x7684;&#x53E6;&#x5916;&#x4E00;&#x5934;&#xFF0C;&#x4F60;&#x90FD;&#x4E0D;&#x77E5;&#x9053;&#x751A;&#x81F3;&#x5750;&#x7740;&#x4E00;&#x6761;&#x72D7;&#x3002;</p>
<p><img src="../images/220px-Internet_dog.jpg" alt="220px-Internet_dog.jpg"></p>
<p>&#x50CF;&#x7279;&#x522B;&#x590D;&#x6742;&#x7684;&#x5206;&#x5E03;&#x5F0F;&#x7CFB;&#x7EDF;&#xFF0C;&#x7279;&#x522B;&#x662F;&#x5728;&#x5927;&#x516C;&#x53F8;&#x91CC;&#xFF0C;&#x591A;&#x4E2A;&#x56E2;&#x961F;&#x3001;&#x5927;&#x578B;&#x534F;&#x4F5C;&#xFF0C;&#x4F60;&#x53EF;&#x80FD;&#x90FD;&#x4E0D;&#x77E5;&#x9053;&#x670D;&#x52A1;&#x662F;&#x8C01;&#x7684;&#xFF0C;&#x5F88;&#x53EF;&#x80FD;&#x8BF4;&#x5F00;&#x53D1;&#x670D;&#x52A1;&#x7684;&#x90A3;&#x4E2A;&#x54E5;&#x513F;&#x4EEC;&#x751A;&#x81F3;&#x662F;&#x4E00;&#x4E2A;&#x5B9E;&#x4E60;&#x751F;&#x3002;&#x4F9D;&#x8D56;&#x670D;&#x52A1;&#x7684;&#x63A5;&#x53E3;&#x6027;&#x80FD;&#x53EF;&#x80FD;&#x5F88;&#x4E0D;&#x7A33;&#x5B9A;&#xFF0C;&#x6709;&#x65F6;&#x5019; 2ms&#xFF0C;&#x6709;&#x65F6;&#x5019; 200ms&#xFF0C;&#x751A;&#x81F3; 2s&#xFF0C;&#x90FD;&#x6709;&#x53EF;&#x80FD;&#x3002;</p>
<p>&#x5982;&#x679C;&#x4F60;&#x4E0D;&#x5BF9;&#x5404;&#x79CD;&#x4F9D;&#x8D56;&#x670D;&#x52A1;&#x63A5;&#x53E3;&#x7684;&#x8C03;&#x7528;&#x505A;&#x8D85;&#x65F6;&#x63A7;&#x5236;&#xFF0C;&#x6765;&#x7ED9;&#x4F60;&#x7684;&#x670D;&#x52A1;&#x63D0;&#x4F9B;&#x5B89;&#x5168;&#x4FDD;&#x62A4;&#x63AA;&#x65BD;&#xFF0C;&#x90A3;&#x4E48;&#x5F88;&#x53EF;&#x80FD;&#x4F60;&#x7684;&#x670D;&#x52A1;&#x5C31;&#x88AB;&#x5404;&#x79CD;&#x5783;&#x573E;&#x7684;&#x4F9D;&#x8D56;&#x670D;&#x52A1;&#x7684;&#x6027;&#x80FD;&#x7ED9;&#x62D6;&#x6B7B;&#x4E86;&#x3002;&#x5927;&#x91CF;&#x7684;&#x63A5;&#x53E3;&#x8C03;&#x7528;&#x5F88;&#x6162;&#xFF0C;&#x5927;&#x91CF;&#x7684;&#x7EBF;&#x7A0B;&#x88AB;&#x5361;&#x6B7B;&#x3002;&#x5982;&#x679C;&#x4F60;&#x505A;&#x4E86;&#x8D44;&#x6E90;&#x7684;&#x9694;&#x79BB;&#xFF0C;&#x90A3;&#x4E48;&#x4E5F;&#x5C31;&#x662F;&#x7EBF;&#x7A0B;&#x6C60;&#x7684;&#x7EBF;&#x7A0B;&#x88AB;&#x5361;&#x6B7B;&#xFF0C;&#x4F46;&#x5176;&#x5B9E;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x505A;&#x8D85;&#x65F6;&#x63A7;&#x5236;&#xFF0C;&#x6CA1;&#x5FC5;&#x8981;&#x8BA9;&#x5B83;&#x4EEC;&#x5168;&#x5361;&#x6B7B;&#x3002;</p>
<h3 id="timeoutmilliseconds">TimeoutMilliseconds</h3>
<p>&#x5728; Hystrix &#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x624B;&#x52A8;&#x8BBE;&#x7F6E; timeout &#x65F6;&#x957F;&#xFF0C;&#x5982;&#x679C;&#x4E00;&#x4E2A; command &#x8FD0;&#x884C;&#x65F6;&#x95F4;&#x8D85;&#x8FC7;&#x4E86;&#x8BBE;&#x5B9A;&#x7684;&#x65F6;&#x957F;&#xFF0C;&#x90A3;&#x4E48;&#x5C31;&#x88AB;&#x8BA4;&#x4E3A;&#x662F; timeout&#xFF0C;&#x7136;&#x540E; Hystrix command &#x6807;&#x8BC6;&#x4E3A; timeout&#xFF0C;&#x540C;&#x65F6;&#x6267;&#x884C; fallback &#x964D;&#x7EA7;&#x903B;&#x8F91;&#x3002;</p>
<p><code>TimeoutMilliseconds</code> &#x9ED8;&#x8BA4;&#x503C;&#x662F; 1000&#xFF0C;&#x4E5F;&#x5C31;&#x662F; 1000ms&#x3002;</p>
<pre><code class="lang-java">HystrixCommandProperties.Setter()
    ..withExecutionTimeoutInMilliseconds(<span class="hljs-keyword">int</span>)
</code></pre>
<h3 id="timeoutenabled">TimeoutEnabled</h3>
<p>&#x8FD9;&#x4E2A;&#x53C2;&#x6570;&#x7528;&#x4E8E;&#x63A7;&#x5236;&#x662F;&#x5426;&#x8981;&#x6253;&#x5F00; timeout &#x673A;&#x5236;&#xFF0C;&#x9ED8;&#x8BA4;&#x503C;&#x662F; true&#x3002;</p>
<pre><code class="lang-java">HystrixCommandProperties.Setter()
    .withExecutionTimeoutEnabled(<span class="hljs-keyword">boolean</span>)
</code></pre>
<h2 id="&#x5B9E;&#x4F8B;-demo">&#x5B9E;&#x4F8B; Demo</h2>
<p>&#x6211;&#x4EEC;&#x5728; command &#x4E2D;&#xFF0C;&#x5C06;&#x8D85;&#x65F6;&#x65F6;&#x95F4;&#x8BBE;&#x7F6E;&#x4E3A; 500ms&#xFF0C;&#x7136;&#x540E;&#x5728; run() &#x65B9;&#x6CD5;&#x4E2D;&#xFF0C;&#x8BBE;&#x7F6E;&#x4F11;&#x7720;&#x65F6;&#x95F4; 1s&#xFF0C;&#x8FD9;&#x6837;&#x4E00;&#x4E2A;&#x8BF7;&#x6C42;&#x8FC7;&#x6765;&#xFF0C;&#x76F4;&#x63A5;&#x4F11;&#x7720; 1s&#xFF0C;&#x7ED3;&#x679C;&#x5C31;&#x4F1A;&#x56E0;&#x4E3A;&#x8D85;&#x65F6;&#x800C;&#x6267;&#x884C;&#x964D;&#x7EA7;&#x903B;&#x8F91;&#x3002;</p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">GetProductInfoCommand</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">HystrixCommand</span>&lt;<span class="hljs-title">ProductInfo</span>&gt; </span>{

    <span class="hljs-keyword">private</span> Long productId;

    <span class="hljs-keyword">private</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">final</span> HystrixCommandKey KEY = HystrixCommandKey.Factory.asKey(<span class="hljs-string">&quot;GetProductInfoCommand&quot;</span>);

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">GetProductInfoCommand</span><span class="hljs-params">(Long productId)</span> </span>{
        <span class="hljs-keyword">super</span>(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey(<span class="hljs-string">&quot;ProductInfoService&quot;</span>))
                .andCommandKey(KEY)
                .andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter()
                        .withCoreSize(<span class="hljs-number">8</span>)
                        .withMaxQueueSize(<span class="hljs-number">10</span>)
                        .withQueueSizeRejectionThreshold(<span class="hljs-number">8</span>))
                .andCommandPropertiesDefaults(HystrixCommandProperties.Setter()
                        .withCircuitBreakerEnabled(<span class="hljs-keyword">true</span>)
                        .withCircuitBreakerRequestVolumeThreshold(<span class="hljs-number">20</span>)
                        .withCircuitBreakerErrorThresholdPercentage(<span class="hljs-number">40</span>)
                        .withCircuitBreakerSleepWindowInMilliseconds(<span class="hljs-number">3000</span>)
                        <span class="hljs-comment">// &#x8BBE;&#x7F6E;&#x662F;&#x5426;&#x6253;&#x5F00;&#x8D85;&#x65F6;&#xFF0C;&#x9ED8;&#x8BA4;&#x662F;true</span>
                        .withExecutionTimeoutEnabled(<span class="hljs-keyword">true</span>)
                        <span class="hljs-comment">// &#x8BBE;&#x7F6E;&#x8D85;&#x65F6;&#x65F6;&#x95F4;&#xFF0C;&#x9ED8;&#x8BA4;1000(ms)</span>
                        .withExecutionTimeoutInMilliseconds(<span class="hljs-number">500</span>)
                        .withFallbackIsolationSemaphoreMaxConcurrentRequests(<span class="hljs-number">30</span>)));
        <span class="hljs-keyword">this</span>.productId = productId;
    }

    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">protected</span> ProductInfo <span class="hljs-title">run</span><span class="hljs-params">()</span> <span class="hljs-keyword">throws</span> Exception </span>{
        System.out.println(<span class="hljs-string">&quot;&#x8C03;&#x7528;&#x63A5;&#x53E3;&#x67E5;&#x8BE2;&#x5546;&#x54C1;&#x6570;&#x636E;&#xFF0C;productId=&quot;</span> + productId);

        <span class="hljs-comment">// &#x4F11;&#x7720;1s</span>
        TimeUtils.sleep(<span class="hljs-number">1</span>);

        String url = <span class="hljs-string">&quot;http://localhost:8081/getProductInfo?productId=&quot;</span> + productId;
        String response = HttpClientUtils.sendGetRequest(url);
        System.out.println(response);
        <span class="hljs-keyword">return</span> JSONObject.parseObject(response, ProductInfo.class);
    }

    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">protected</span> ProductInfo <span class="hljs-title">getFallback</span><span class="hljs-params">()</span> </span>{
        ProductInfo productInfo = <span class="hljs-keyword">new</span> ProductInfo();
        productInfo.setName(<span class="hljs-string">&quot;&#x964D;&#x7EA7;&#x5546;&#x54C1;&quot;</span>);
        <span class="hljs-keyword">return</span> productInfo;
    }
}
</code></pre>
<p>&#x5728;&#x6D4B;&#x8BD5;&#x7C7B;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x76F4;&#x63A5;&#x53D1;&#x8D77;&#x8BF7;&#x6C42;&#x3002;</p>
<pre><code class="lang-java"><span class="hljs-meta">@SpringBootTest</span>
<span class="hljs-meta">@RunWith</span>(SpringRunner.class)
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">TimeoutTest</span> </span>{

    <span class="hljs-meta">@Test</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">testTimeout</span><span class="hljs-params">()</span> </span>{
        HttpClientUtils.sendGetRequest(<span class="hljs-string">&quot;http://localhost:8080/getProductInfo?productId=1&quot;</span>);
    }
}
</code></pre>
<p>&#x7ED3;&#x679C;&#x4E2D;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#xFF0C;&#x6253;&#x5370;&#x51FA;&#x4E86;&#x964D;&#x7EA7;&#x5546;&#x54C1;&#x76F8;&#x5173;&#x4FE1;&#x606F;&#x3002;</p>
<pre><code class="lang-c">ProductInfo(id=null, name=&#x964D;&#x7EA7;&#x5546;&#x54C1;, price=null, pictureList=null, specification=null, service=null, color=null, size=null, shopId=null, modifiedTime=null, cityId=null, cityName=null, brandId=null, brandName=null)
{<span class="hljs-string">&quot;id&quot;</span>: <span class="hljs-number">1</span>, <span class="hljs-string">&quot;name&quot;</span>: <span class="hljs-string">&quot;iphone7&#x624B;&#x673A;&quot;</span>, <span class="hljs-string">&quot;price&quot;</span>: <span class="hljs-number">5599</span>, <span class="hljs-string">&quot;pictureList&quot;</span>:<span class="hljs-string">&quot;a.jpg,b.jpg&quot;</span>, <span class="hljs-string">&quot;specification&quot;</span>: <span class="hljs-string">&quot;iphone7&#x7684;&#x89C4;&#x683C;&quot;</span>, <span class="hljs-string">&quot;service&quot;</span>: <span class="hljs-string">&quot;iphone7&#x7684;&#x552E;&#x540E;&#x670D;&#x52A1;&quot;</span>, <span class="hljs-string">&quot;color&quot;</span>: <span class="hljs-string">&quot;&#x7EA2;&#x8272;,&#x767D;&#x8272;,&#x9ED1;&#x8272;&quot;</span>, <span class="hljs-string">&quot;size&quot;</span>: <span class="hljs-string">&quot;5.5&quot;</span>, <span class="hljs-string">&quot;shopId&quot;</span>: <span class="hljs-number">1</span>, <span class="hljs-string">&quot;modifiedTime&quot;</span>: <span class="hljs-string">&quot;2017-01-01 12:00:00&quot;</span>, <span class="hljs-string">&quot;cityId&quot;</span>: <span class="hljs-number">1</span>, <span class="hljs-string">&quot;brandId&quot;</span>: <span class="hljs-number">1</span>}
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="hystrix-thread-pool-current-limiting.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: 深入 Hystrix 线程池隔离与接口限流">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"基于 timeout 机制为服务接口调用超时提供安全保护","level":"3.17","depth":1,"next":{"title":"高可用系统","level":"3.18","depth":1,"ref":"","articles":[{"title":"如何设计一个高可用系统？","level":"3.18.1","depth":2,"ref":"","articles":[]}]},"previous":{"title":"深入 Hystrix 线程池隔离与接口限流","level":"3.16","depth":1,"path":"high-availability/hystrix-thread-pool-current-limiting.md","ref":"high-availability/hystrix-thread-pool-current-limiting.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"high-availability/hystrix-timeout.md","mtime":"2019-12-30T01:36:31.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-01-08T09:33:59.173Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

